import app as robot_script

class Motion:

    def __init__(self, framework):
        self.framework = framework
        self.status = False
        self.linear_x = 0.00
        self.linear_y = 0.00
        self.linear_z = 0.00

    # 运动控制
    def control_motion(self, linear_x, linear_y, linear_z):
        self.status = True
        self.linear_x = linear_x
        self.linear_y = linear_y
        self.linear_z = linear_z

    # 停止运动
    def stop_motion(self):
        self.linear_x = 0
        self.linear_y = 0
        self.linear_z = 0
        self.status = False
        if self.framework.cyberdog_subscribe is not None:
            twist = self.framework.cyberdog_pb2.Twist()
            twist.linear.x = 0
            twist.linear.y = 0
            twist.linear.z = 0
            twist.angular.x = 0
            twist.angular.y = 0
            twist.angular.z = 0
            self.framework.cyberdog_subscribe.sendAppDecision(self.framework.cyberdog_pb2.Decissage(twist=twist))

